<template>
  <a-modal
    :visible="visible"
    title="短信验证"
    :width="400"
    :confirmLoading="loading"
    class="education-dailog-login noNav"
    @cancel="()=>{$emit('cancel')}"
    @ok="()=>{$emit('ok')}"
  >
    <a-spin :spinning="loading">
      <a-form :form="form" :labelCol="{sm: {span: 6}}" :wrapperCol="{sm: {span: 18}}" :selfUpdate="true">
        <a-form-item label="短信验证码">
          <a-input v-decorator="['phoneCode', {rules: [{ required: true, message: '短信验证码为空' }]}]"  placeholder="请输入短信验证码"/>
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import { userThirdGetLoginUrl } from '@/api/login'

export default {
  props: {
    visible: {
      type: Boolean,
      required: true,
    },
    loading: {
      type: Boolean,
      default: () => false,
    },
  },
  data() {
    return {
      form: this.$form.createForm(this)
    }
  },
  methods: {
    handleClose() {
      this.$emit('close', false)
    },
  },
  watch:{
    visible:function(n){
      if(n){
        const redirectUrl = window.location.origin + window.location.pathname
        userThirdGetLoginUrl({redirectUrl}).then(res=>{
          this.src = res.data.url
        })
      }
    }
  }
}
</script>
<style lang="less" scoped>

.register-title {
  line-height: 24px;
  font-size: 18px;
}
.education-login-wrap {
  display: flex;
  justify-content: center;
}
.handleText {
  cursor: pointer;
}
</style>

